package com.seanchenxi.gwt.wordpress.xmlrpc.service.local.impl;

import java.util.ArrayList;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.seanchenxi.gwt.wordpress.domain.model.Blog;
import com.seanchenxi.gwt.wordpress.domain.model.Post;
import com.seanchenxi.gwt.wordpress.domain.model.UserInfo;
import com.seanchenxi.gwt.wordpress.xmlrpc.service.BloggerLocalServiceAsync;

/**
 * The Class BloggerLocalServiceAsyncImpl.
 */
public class BloggerLocalServiceAsyncImpl extends
		BloggerLocalServiceAsyncWrapper implements BloggerLocalServiceAsync {

	/**
	 * Instantiates a new blogger local service async impl.
	 * 
	 * @param url
	 *            the url
	 * @param wpUserName
	 *            the wp user name
	 * @param wpPassword
	 *            the wp password
	 */
	public BloggerLocalServiceAsyncImpl(String url, String wpUserName,
			String wpPassword) {
		super(url, wpUserName, wpPassword);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#getUsersBlogs
	 * (com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void getUsersBlogs(AsyncCallback<ArrayList<Blog>> callback) {
		getBloggerService().getUsersBlogs(getWpUserName(), getWpPassword(),
				callback);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#getUserInfo
	 * (com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void getUserInfo(AsyncCallback<ArrayList<UserInfo>> callback) {
		getBloggerService().getUserInfo(getWpUserName(), getWpPassword(),
				callback);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#getPost
	 * (int, com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void getPost(int postId, AsyncCallback<Post> callback) {
		getBloggerService().getPost(postId, getWpUserName(), getWpPassword(),
				callback);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#getRecentPosts
	 * (int, int, com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void getRecentPosts(int blogId, int number,
			AsyncCallback<ArrayList<Post>> callback) {
		getBloggerService().getRecentPosts(blogId, getWpUserName(),
				getWpPassword(), number, callback);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#getTemplate
	 * (int, com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void getTemplate(int blogId, AsyncCallback<String> callback) {
		getBloggerService().getTemplate(blogId, getWpUserName(),
				getWpPassword(), callback);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#setTemplate
	 * (int, java.lang.String, com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void setTemplate(int blogId, String content,
			AsyncCallback<Boolean> callback) {
		getBloggerService().setTemplate(blogId, getWpUserName(),
				getWpPassword(), content, callback);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.seanchenxi.gwt.wordpress.service.BloggerLocalServiceAsync#deletePost
	 * (int, com.google.gwt.user.client.rpc.AsyncCallback)
	 */
	@Override
	public void deletePost(int postId, AsyncCallback<Boolean> callback) {
		getBloggerService().deletePost(postId, getWpUserName(),
				getWpPassword(), callback);
	}

}
